-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve checking LHS of Assign #22977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d38c344
to
48e3493
Compare
48e3493
to
05cd547
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Could rebase on main? There seems to be some conflicts. |
05cd547
to
e7d18a7
Compare
I think it's time for that coffee. Edit: by which I mean, I still have reservations about this simple solution, but I will follow up with an over-engineered solution at a future date. |
Fixes scala#22970 Simple example showing how awkward this is compared to a traversal, where there is more control when descending. Previously, it "ignored" the LHS of Assign to avoid taking `x = y` as ref to `x` instead of assignment to. Now, "mark" the LHS as assignment, so `transformIdent` and `Select` set a "mode" flag, such that `x` is correctly taken as either a ref or assign to `x`. Probably there is more complex syntax to handle as LHS, but I haven't had coffee yet. [Cherry-picked 9bee756]
Fixes scala#22970 Simple example showing how awkward this is compared to a traversal, where there is more control when descending. Previously, it "ignored" the LHS of Assign to avoid taking `x = y` as ref to `x` instead of assignment to. Now, "mark" the LHS as assignment, so `transformIdent` and `Select` set a "mode" flag, such that `x` is correctly taken as either a ref or assign to `x`. Probably there is more complex syntax to handle as LHS, but I haven't had coffee yet.
Fixes #22970
Simple example showing how awkward this is compared to a traversal, where there is more control when descending.
Previously, it "ignored" the LHS of Assign to avoid taking
x = y
as ref tox
instead of assignment to.Now, "mark" the LHS as assignment, so
transformIdent
andSelect
set a "mode" flag, such thatx
is correctly taken as either a ref or assign tox
.Probably there is more complex syntax to handle as LHS, but I haven't had coffee yet.